Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe UI now preserves message events on styled lines and renders them via a new wrapped-message renderer. Update stores message pointers in lines; View delegates rendering of message-backed lines to RenderWrappedMessage which supports width-based wrapping and multi-line indentation. Changes
Sequence Diagram(s)sequenceDiagram
participant AppUpdate as App.Update()
participant MsgEvt as output.MessageEvent
participant StyledLine as styledLine
participant AppView as App.View()
participant Renderer as RenderWrappedMessage()
participant Terminal as Terminal Display
AppUpdate->>MsgEvt: receive MessageEvent
MsgEvt-->>AppUpdate: event data
AppUpdate->>StyledLine: copy & store pointer in message field
StyledLine-->>AppUpdate: stored
AppView->>StyledLine: inspect message field
alt message != nil
StyledLine-->>AppView: has message
AppView->>Renderer: RenderWrappedMessage(event, width)
Renderer->>Renderer: wrap text, add prefixes & indentation
Renderer-->>AppView: formatted string
AppView->>Terminal: render formatted message
else message == nil
StyledLine-->>AppView: no message
AppView->>Terminal: render standard styled line
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/ui/app_test.go (1)
185-189: Consider removingt.Parallel()when modifying global lipgloss state.
lipgloss.SetColorProfilemodifies global state, which can interfere with other parallel tests that depend on the color profile. While the cleanup restores the original value, there's a race window during execution.Option 1: Remove t.Parallel()
func TestAppMessageEventWrapsOnVisibleWidth(t *testing.T) { - t.Parallel() - original := lipgloss.ColorProfile()Option 2: Keep as-is with a comment
func TestAppMessageEventWrapsOnVisibleWidth(t *testing.T) { t.Parallel() + // Note: SetColorProfile is global but other tests don't depend on a specific profile. original := lipgloss.ColorProfile()🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/ui/app_test.go` around lines 185 - 189, The test calls t.Parallel() while changing global lipgloss state via lipgloss.SetColorProfile and restoring it with t.Cleanup, which can race with other parallel tests; remove the call to t.Parallel() in this test (or alternatively document the risk with a clear comment if you must keep parallelism) so the sequence using lipgloss.ColorProfile(), lipgloss.SetColorProfile(termenv.TrueColor) and t.Cleanup(...) runs serially and cannot interfere with other tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/ui/components/message.go`:
- Around line 21-26: Adjust the width math to account for the single space
inserted between the prefix and the message: when checking whether the prefix
alone consumes the line, use width <= len([]rune(prefixText)) + 1, and compute
availableWidth := width - len([]rune(prefixText)) - 1 before calling
wrap.SoftWrap(e.Text, availableWidth); update any other uses that assume no
separator to use the same -1 adjustment (references: prefixText, availableWidth,
wrap.SoftWrap, prefix + " ", styles.Message.Render, e.Text).
---
Nitpick comments:
In `@internal/ui/app_test.go`:
- Around line 185-189: The test calls t.Parallel() while changing global
lipgloss state via lipgloss.SetColorProfile and restoring it with t.Cleanup,
which can race with other parallel tests; remove the call to t.Parallel() in
this test (or alternatively document the risk with a clear comment if you must
keep parallelism) so the sequence using lipgloss.ColorProfile(),
lipgloss.SetColorProfile(termenv.TrueColor) and t.Cleanup(...) runs serially and
cannot interfere with other tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: c7e0cfbd-8134-42c7-a631-292e11b19864
📒 Files selected for processing (3)
internal/ui/app.gointernal/ui/app_test.gointernal/ui/components/message.go
4491fe5 to
2f0b19d
Compare
Some CLI output wraps early, including Warning, Success, and Note messages.